import java.util.*;

public class task3 {
	
	public static int[] change(int sec)throws IllegalArgumentException{
		
		if(sec < 0)
			throw new IllegalArgumentException("Error: java.lang.IllegalArgumentException");
		else {
			int [] x = new int[3];
			
			x[0] = sec / 3600;
			x[1] = (sec%3600)/60;
			x[2] = (sec%3600)%60;
			
			return x;
		}
	}
	
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		try {
			System.out.print("Enter number of seconds [as an integer]: ");
			int sec = sc.nextInt();
			
			int h = change(sec)[0];
			int m = change(sec)[1];
			int s = change(sec)[2];
			
			System.out.printf("%d seconds = %d hours, %d minutes, and %d seconds", sec , h, m, s);
		}catch(IllegalArgumentException e) {
			System.err.print(e);
		}catch(InputMismatchException e) {
			System.out.print("Error: java.util.InputMismatchException");
		}
		
		sc.close();

	}

}
